﻿using Alos.Common;
using Alos.Entity;
using Alos.IService;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;

namespace Alos.LanClass.Api
{
    /// <summary>
    /// 授权
    /// </summary>
    public class AuthController : ApiController
    {
        /// <summary>
        /// 更新用户sk
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        [Route("api/auth/update")]
        public JsonRtn<string> update()
        {
            var jsRtn = new JsonRtn<string>();
            var user = Common.Current.User;
            user.dt = ((DateTime.Now.DayOfYear) * 24 + DateTime.Now.Hour);
            user.ip = HttpContext.Current.Request.UserHostAddress;
            jsRtn.data = Common.Current.GetSessionKey(user);
            return jsRtn;
        }
    }
}